/*
 * $Author: isan.wong@gmail.com $
 * $Date: 2011-07-29 01:03:06 +0000 (Fri, 29 Jul 2011) $
 * $Rev: 13 $
 * $URL: http://capitalbio-smd.googlecode.com/svn/src/com/capitalbio/smd/gui/AboutDialog.java $
 */

package com.capitalbio.smd.gui;

import java.awt.BorderLayout;
import java.awt.Font;
import java.awt.Frame;
import javax.swing.BoxLayout;
import javax.swing.ImageIcon;
import javax.swing.JDialog;
import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.JTextArea;
import javax.swing.border.EmptyBorder;

import com.capitalbio.smd.base.Util;

public class AboutDialog extends JDialog {

	private static final long serialVersionUID = 1L;

	public AboutDialog(Frame owner) {
		super(owner, "About", true);
		
		JLabel lbl = new JLabel(new ImageIcon(Util.getResourceURL("splash.png")));
		lbl.setBorder(new EmptyBorder(0, 0, 0, 0));
		JPanel p = new JPanel();
		p.add(lbl);
		getContentPane().add(p, BorderLayout.NORTH);

		String message = "CapitalBio Sequence Mutation Detector\nv." +
			Util.getProperties().getProperty("smd.program.version") +
			" build." + 
			Util.getProperties().getProperty("smd.program.build") +
			"\n\nWang Lei, Xie Feng-Bo, Liu Xiang, Cheng Jing";
		JTextArea txt = new JTextArea(message);
		txt.setBorder(new EmptyBorder(5, 10, 5, 10));
		txt.setFont(new Font("Helvetica", Font.BOLD, 13));
		txt.setEditable(false);
		txt.setBackground(getBackground());
		p = new JPanel();
		p.setLayout(new BoxLayout(p, BoxLayout.Y_AXIS));
		p.add(txt);

		message = "For research use only.";
		txt = new JTextArea(message);
		txt.setBorder(new EmptyBorder(5, 10, 10, 10));
		txt.setFont(new Font("Arial", Font.PLAIN, 12));
		txt.setEditable(false);
		txt.setBackground(getBackground());
		p.add(txt);
		getContentPane().add(p, BorderLayout.CENTER);

		pack();
		setResizable(false);
		setLocationRelativeTo(owner);
	}
}